import http from "@/http/http"
import { ListParam,AddDeptModel } from './DeptModel'

enum Api {
    getDeptList = '/api/department/list',
    getParent = '/api/department/parent',
    add = '/api/department',
    edit = '/api/department',
    delete = '/api/department'
}

// 查询部门列表
export const getDeptListApi = async (params:ListParam) => {
    return await http.get(Api.getDeptList,params)
}

// 查询上级部门树
export const getDeptParentApi = async () => {
    return await http.get(Api.getParent)
}

// 新增
export const addDeptApi = async (params:AddDeptModel) => {
    return await http.post(Api.add,params)
}

// 编辑
export const editDeptApi = async (params:AddDeptModel) => {
    return await http.put(Api.edit,params)
}

// 删除
export const deleteDeptApi =async (params:any) => {
    return await http.delete(Api.delete,params)
}
